package com.yellowpage.ca.dao;

import java.util.List;

import com.yellowpage.ca.data.Configuration;
import com.yellowpage.white.dao.BaseDaoHibernateImpl;


public class ConfigurationDaoImpl extends BaseDaoHibernateImpl<Configuration, Long>
		implements	ConfigurationDao {

	public ConfigurationDaoImpl() {
		super(Configuration.class);
	}

    @SuppressWarnings("unchecked")
    public List getConfigurationsByType(String type){
        String queryString = "FROM Configuration conf " +
                "			 WHERE conf.type = '" + type+"' order by conf.configurationId";
        List configs = this.getHibernateTemplate().find(queryString);
        return configs; 
    }
    
    @SuppressWarnings("unchecked")
    public String getConfigValue(String key){
        String queryString = "FROM Configuration conf " +
                "			 WHERE conf.code = '" + key+"'";
        List configs = this.getHibernateTemplate().find(queryString);
        return ((Configuration)configs.get(0)).getValue(); 
    }



}
